import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import {AtSearchBar,AtCheckbox,AtButton} from 'taro-ui'
import './dongtaihaoyou.scss'
import { $navigateTo } from '../../../../global';
import reactMixin from 'react-mixin';
import myJs from './dongtaihaoyouJs.js'
import app from '../../../../main.js'

export default class Dongtaihaoyou extends Component {
    config = {
        navigationBarTitleText: '@好友'
    }
    constructor () { 
        super(...arguments); 
        this.state = this.getData(); 
    }
    init(){
        this.setState({
            checkedList: [],
            search:''
        });
    }
    go(url){
        $navigateTo(url);
    }
    render () {
        return (
            <View className='dongtaihaoyou'>
                <AtSearchBar 
                 placeholder='搜索'
                 value={this.state.search}
                 onChange={this.handleChange.bind(this,'search')}
                 ></AtSearchBar>
                <Text className=' class_0'>已选择：张医生，李医生</Text>
                <AtCheckbox 
                options={
                    this.state.friendss.items.map(item=>{
                        return {
                            label:item.member_name,
                            desc:item.type,
                            value:item.id
                        }
                    })
                }
                className=' class_1'
                selectedList={this.state.checkedList}
                onChange={this.handleChange.bind(this,'checkedList')}
                >
                </AtCheckbox>
                <View className='blank-box'></View>
                <AtButton full type='primary' className='confirm-btn' onClick={this.go.bind(this,'../fabudongtai/fabudongtai')}>确定</AtButton>
            </View>
        );
    }
}
reactMixin.onClass(Dongtaihaoyou,myJs);